/*

Dofile: table6.do 

Date: Dec. 10, 2016 
Aim: Look at the impact of EMTR and tax haven status on exported quantities   

Input: base_for_reg.dta 
Output: table6.xls 
Reported in the paper: "Table 6 – Quantities and tax havens"

*/  

cd $datapath
use base_for_reg, clear 

g lqty=log(xqty) 
global name table5 // name of the xls file where the results are sent 


*** focus on intra-firm flows 
areg lqty type dum_hines if tarif!=. & type==1, absorb(fpt) vce(cluster pays)
outreg2  type dum_hines inter_tarif tarif inter_lgdpc lgdpc inter_ldist ldist  using  "$resultpath/$threshold/$name.xls" ,  label e(all) nocons bdec(2) symbol($^{***}$, $^{**}$, $^{*}$) adjr2    replace 
global tax_var dum_hines linvemtr // tax variable and its interaction 
areg lqty type $tax_var ldist lgdpc lgdp tarif if tarif!=. & type==1 , absorb(fpt) vce(cluster pays)
outreg2  type $tax_var inter_tarif tarif inter_lgdpc lgdpc lgdp inter_ldist ldist  using  "$resultpath/$threshold/$name.xls" ,  label e(all) nocons bdec(2) symbol($^{***}$, $^{**}$, $^{*}$) adjr2    append 

*** all flows 
areg lqty type dum_hines  interdum_hines  , absorb(fpt) vce(cluster pays)
outreg2  type dum_hines interdum_hines inter_tarif tarif inter_lgdpc lgdpc inter_ldist ldist    using  "$resultpath/$threshold/$name.xls" ,  label e(all) nocons bdec(2) symbol($^{***}$, $^{**}$, $^{*}$) adjr2   append 
areg lqty type interdum_hines dum_hines inter_linvemtr linvemtr inter_tarif tarif inter_lgdpc lgdpc lgdp inter_lgdp inter_ldist ldist cty_*   , absorb(fpt) vce(cluster pays)
outreg2  type interdum_hines dum_hines inter_linvemtr linvemtr inter_tarif tarif inter_lgdpc lgdpc lgdp inter_lgdp inter_ldist ldist    using  "$resultpath/$threshold/$name.xls" ,  label e(all) nocons bdec(2) symbol($^{***}$, $^{**}$, $^{*}$) adjr2   append 
